const http = require('http')
 const querystring = require("querystring")
const logger = require('../log')

const server = http.createServer((req, res) => {
    // const url = req.url

    let data = ''
    req.on('data', (chunk) => {
        data += chunk
    })
    req.on('end', () => {
        res.writeHead(200, {
            'content-type': "text/html"
        })
        logger.debug(data)
        res.write(JSON.stringify(querystring.parse(data)))
        res.end()
    })


})
server.listen('3000', () => {
    console.log('q');
})

// 浏览器端调试
    // node --inspect --inspect-brk server.js
// node进程管理包
//  supervisor
//  nodemon
//  forever
//  pm2
